<template>
  <div class="item-panel-list" :class="isExpanded ? 'expanded' : ''">
    <div class="item-panel-list-title" @click="isExpanded = !isExpanded">
      <i
        class="icon iconfont"
        :class="isExpanded ? 'icon-folderopen' : 'icon-Folderclose'"
      ></i>
      <span class="title">{{ items.name }}</span>
    </div>
    <ul class="item-panel-items">
      <item-panel-item
        v-for="(item, index) in items.children"
        :key="index"
        :item="item"
      ></item-panel-item>
    </ul>
  </div>
</template>

<script>
import ItemPanelItem from "./item-panel-item.vue";

export default {
  name: "item-panel-list",
  components: {
    ItemPanelItem,
  },
  props: {
    items: {
      type: Object,
      default: () => {
        return {
          name: "Flowchart 流程图",
          children: [],
        };
      },
    },
  },
  data() {
    return {
      isExpanded: false,
    };
  },
};
</script>

<style>
ul,
li {
  list-style-type: none;
  list-style: none;
}
</style>
